package ru.lukyanets.transmission.client;

import com.google.common.eventbus.EventBus;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import javafx.application.Application;
import javafx.stage.Stage;
import ru.lukyanets.transmission.client.app.PrimaryStage;
import ru.lukyanets.transmission.client.ui.window.MainWindow;


public class Main extends Application {


    @Override
    public void init() throws Exception {
        super.init();
    }

    @Override
    public void start(final Stage primaryStage) {
        Guice.createInjector(new AbstractModule() {
            @Override
            protected void configure() {
                bind(Stage.class).annotatedWith(PrimaryStage.class).toInstance(primaryStage);
                bind(MainWindow.class).asEagerSingleton();
                bind(EventBus.class).asEagerSingleton();
            }
        });
    }

    public static void main(String[] args) {
        launch(args);
    }
}
